package com.unsk.item
{
	import Box2D.Collision.b2ContactPoint;
	import Box2D.Dynamics.b2Body;
	import Box2D.Dynamics.b2ContactListener;
	
	import com.unsk.util.Log;
	
	public class Box2DBodyContactListener extends b2ContactListener
	{
		private var isInContact:Function;
		private var body:b2Body;
		
		public function Box2DBodyContactListener(body:b2Body, isInContactCallBack:Function):void
		{
			this.body = body;
			this.isInContact = isInContactCallBack;
		}
		public override function Add(point:b2ContactPoint):void
		{
			var body1:b2Body = point.shape1.GetBody();
			var body2:b2Body = point.shape2.GetBody();
			
			if(body == body1)
				isInContact();
			
			if(body == body2)
				isInContact();
		}
	}
}